/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * XinxetoView.java
 *
 * Created on 29/05/2011, 18:18:40
 */

package presentation;
import java.awt.Graphics;
import javax.swing.ImageIcon;
/**
 *
 * @author Andreu Marimon
 */
public class XinxetoView extends javax.swing.JPanel {
    PresentationController _pCntrl;

    /** Creates new form XinxetoView */
 
    public XinxetoView (PresentationController pCntrl) {
        _pCntrl = pCntrl;
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setMaximumSize(new java.awt.Dimension(112, 108));
        setMinimumSize(new java.awt.Dimension(112, 108));
        setOpaque(false);
        setPreferredSize(new java.awt.Dimension(112, 108));
        addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                click(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 112, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 108, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents

    private void click(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_click
	_pCntrl.goToHelp();
    }//GEN-LAST:event_click


    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
    @Override
    public void paintComponent(Graphics g) {
        super.paintComponent(g);
        if (_pCntrl.getAssistant() != 0) {
	ImageIcon background;
      String slash = System.getProperty("file.separator");
       String jarPath = System.getProperty("java.class.path");
       int lastDot = jarPath.lastIndexOf(";");
       String aux = jarPath;
       if (lastDot != -1) {
            aux = jarPath.substring(0, lastDot);
       }
       int lastSlash = aux.lastIndexOf(slash);
       String path = aux.substring(0,lastSlash+1);
        background = new ImageIcon(path+"imatges"+slash+"xinxetoSmall.png");
		g.drawImage(background.getImage(), 0, 0, 105, 100, null );
	}
    }
}
